import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;

import java.util.ArrayList;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;


public class TaskTest {

	//private Task task1, task2, task3, task4, task5;
	double Duration = 1030;
	int maxTask = 20;
	ArrayList<Task> allTask;
	@Before
	public void setUp() throws Exception {
		 
		allTask = new ArrayList<Task>();
		 for (int i = 0; i < maxTask; i++)
		 {
			  allTask.add(new Task("1","First","Description1",10,"Deliver1","Duedate1","task1")); 

		 }
		/*task1 = new Task("1","First","Description1",10,"Deliver1","Duedate1","task1");
		task2 = new Task("1","First","Description1",10,"Deliver1","Duedate1","task1");
		task3 = new Task("1","First","Description1",10,"Deliver1","Duedate1","task1");
		task4 = new Task("1","First","Description1",10,"Deliver1","Duedate1","task1");
		task5 = new Task("1","First","Description1",10,"Deliver1","Duedate1","task1");*/
		 System.out.println("Before");
	}

	@Test
	public void testGetId() {
		for (int i = 0; i < maxTask; i++)
		 {
			assertEquals(allTask.get(i).getId(), "1");
			System.out.println("Test getId: " + allTask.get(i).getId());
		 }
		allTask.get(1).setId("2");
		assertEquals(allTask.get(1).getId(), "2");
		/*assertEquals(task1.getId(), "1");
        assertEquals(task2.getId(), "1");
        assertEquals(task3.getId(), "1");
        assertEquals(task4.getId(), "1");
        assertEquals(task5.getId(), "1");*/
        //System.out.println("Test getId");
	}

	@Test
	public void testGetTitle() {
		for (int i = 0; i < maxTask; i++)
		 {
			assertEquals(allTask.get(i).getTitle(), "First");
			System.out.println("Test getTitle: " + allTask.get(i).getTitle());
		 }
       /* assertEquals(task1.getTitle(), "First");
        assertEquals(task2.getTitle(), "First");
        assertEquals(task3.getTitle(), "First");
        assertEquals(task4.getTitle(), "First");
        assertEquals(task5.getTitle(), "First");*/
        //System.out.println("Test getTitle");
	}

	@Test
	public void testGetDescription() {
		for (int i = 0; i < maxTask; i++)
		 {
			assertEquals(allTask.get(i).getDescription(), "Description1");
			System.out.println("Test getDescription: " + allTask.get(i).getDescription());
		 }
        /*assertEquals(task1.getDescription(), "Description1");
        assertEquals(task2.getDescription(), "Description1");
        assertEquals(task3.getDescription(), "Description1");
        assertEquals(task4.getDescription(), "Description1");
        assertEquals(task5.getDescription(), "Description1");*/
        //System.out.println("Test getDescription");
	}

	@Test
	public void testGetDuration() {
		for (int i = 0; i < maxTask; i++)
		 {
			assertEquals(allTask.get(i).getDuration(), 10,1);
			System.out.println("Test getDuration: " + allTask.get(i).getDuration());
		 }
		
		/*assertEquals(task1.getDuration(), 10,1);
		assertEquals(task2.getDuration(), 10,1);
		assertEquals(task3.getDuration(), 10,1);
		assertEquals(task4.getDuration(), 10,1);
		assertEquals(task5.getDuration(), 10,1);*/
        //System.out.println("Test getDuration");
	}

	@Test
	public void testGetDeliverable() {
		for (int i = 0; i < maxTask; i++)
		 {
			assertEquals(allTask.get(i).getDeliverable(), "Deliver1");
			System.out.println("Test getDeliverable: " + allTask.get(i).getDeliverable());
		 }
        /*assertEquals(task1.getDeliverable(), "Deliver1");
        assertEquals(task2.getDeliverable(), "Deliver1");
        assertEquals(task3.getDeliverable(), "Deliver1");
        assertEquals(task4.getDeliverable(), "Deliver1");
        assertEquals(task5.getDeliverable(), "Deliver1");*/
        //System.out.println("Test getDeliverable");
	}

	@Test
	public void testGetDeadline() {
		for (int i = 0; i < maxTask; i++)
		 {
			assertEquals(allTask.get(i).getDeadline(), "Duedate1");
			System.out.println("Test getDeadline: " + allTask.get(i).getDeadline());
		 }
        /*assertEquals(task1.getDeadline(), "Duedate1");
        assertEquals(task2.getDeadline(), "Duedate1");
        assertEquals(task3.getDeadline(), "Duedate1");
        assertEquals(task4.getDeadline(), "Duedate1");
        assertEquals(task5.getDeadline(), "Duedate1");*/
        //System.out.println("Test getDeadline");
	}
	
	@Test
	public void testGetperson() {
		for (int i = 0; i < maxTask; i++)
		 {
			assertEquals(allTask.get(i).getPerson(), "task1");
			System.out.println("Test getPerson: " + allTask.get(i).getPerson());
		 }
        /*assertEquals(task1.getPerson(), "task1");
        assertEquals(task2.getPerson(), "task1");
        assertEquals(task3.getPerson(), "task1");
        assertEquals(task4.getPerson(), "task1");
        assertEquals(task5.getPerson(), "task1");*/
        //System.out.println("Test getPerson");
	}
	
	@After
	public void tearDown() throws Exception {
		//task1 = null;
		 System.out.println("After");
	}
}
